/**
 * @Author：ming
 * @Date：2023/9/30 5:11 PM
 * @Filename：Lc11
 */

/**
 * @author ming
 */
public class Lc11 {
    public int maxArea(int[] height){
        int maxv = 0;

        int l = 0;
        int r = height.length-1;

        while (l<r){
            int v = Math.min(height[l],height[r])*(r-l);
            if(v>maxv){
                maxv = v;
            }

            if(height[l]>height[r]){
                r--;
            }else {
                l++;
            }

        }

        return maxv;
    }
}
